



<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>解构表达式</title>
</head>
<body>

    <script>
        
        //数据解耦
        let arr = [1,2,3];

        let a = arr[0]
        console.log(a)

        let c = arr[2]
        console.log(c)

        let b = arr[1]
        console.log(b)



        //以前我们想获得其中的值，只能通过角标。ES6可以这样
        const [x,y,z] = arr; // x,y,z将与arr中的每个位置对应来取值

        //然后打印
        console.log(x,y,z);


        //对象解耦





    </script>
    
</body>
</html>